import csv
import re

csvfile = file('stock.csv', 'rb')
reader = csv.reader(csvfile)
res = []
result = []

for line in reader:
    res = re.split(',',str(line))
    st = re.split('"', res[0])
    if st[0] in result:
	st[0] = '***' + st[0]
    result.append(st[0] )

csvfile.close() 

result_file = open('result_file.txt', 'w')
for line in result:
    result_file.writelines(line + '\n')
